clear all
set more off


***********************************************************
//// 02-PROCESS_COURT: IMPORT AND SAVE RAW TCATS DATA ////
***********************************************************

forval y=2005/2017 {

import delimited using "${raw}/TCATS/goncalves_`y'.txt", clear delim("|")

ren v1 citationnumber
ren v3 countynum
ren v6 disp_order
ren v7 disp_date
ren v23 viol_code
ren v30 verdict

keep citationnumber countynum disp_order disp_date viol_code verdict
replace citationnumber=trim(upper(citationnumber))
cap destring disp_order, replace force
qui compress
saveold "${temp}/t_`y'", replace

}


use "${temp}/t_2005", clear
forval y=2006/2017 {
qui append using "${temp}/t_`y'"
}

qui compress
saveold "${temp}/process-court", replace

forval y=2005/2017 {
rm "${temp}/t_`y'.dta"
}


